package com.jacky.serial;

import org.junit.Test;

import java.io.*;

public class SingletonTests {
    @Test
    public void SingleTest() throws IOException, ClassNotFoundException {
        SingletonE single = SingletonE.getInstance();

        File file = new File("E:/single.txt");
        OutputStream out = new FileOutputStream(file);
        final ObjectOutputStream oos = new ObjectOutputStream(out);
        oos.writeObject(single);

        InputStream in = new FileInputStream(file);
        final ObjectInputStream ois = new ObjectInputStream(in);
        final Object object = ois.readObject();

        System.out.println("single="+single);
        System.out.println("object="+object);
    }
}
